<?php
    echo $this->Html->script('nav/switchNavigation');
    echo $this->Element("nav/userHomeNav");
   
    $usersSports = $user['Sport'];
    $user = $user['User'];
    
?>


    <h2>Profile</h2>
    
    <div class="col4 left">
        <h3>Informations</h3>
        <table>
            <thead>
                <tr>
                    <td class="rowTitle"> Pseudo</td>
                    <td>
                        <?php echo $user['pseudo'];?>
                    </td>
                </tr>
                <tr>
                    <td class="rowTitle"> Member since </td>
                    <td>
                        <?php echo  $this->Date->getDisplay($user['date_creation']);?>
                    </td>
                </tr>
                <tr>
                    <td class="rowTitle"> Name </td>
                    <td>
                        <?php echo $user['name'];?>
                    </td>
                </tr>
                <tr>
                    <td class="rowTitle"> Surname </td>
                    <td>
                        <?php echo $user['surname'];?>
                    </td>
                </tr>
               
                <?php
                if (!empty($user['born'])){
                ?>
                <tr>
                    <td class="rowTitle"> Born date </td>
                    <td>
                        <?php echo $this->Date->getDisplay($user['born']);?>
                    </td>
                </tr>
                <?php
                }
                
                ?>
                
                            
            
                
            </thead>
        </table>
        <p>         
            <?php
                echo $this->Html->link('Modify my Profile',array('action' => 'editProfile'));
            ?>
        </p>
    </div>
    <div class=" right col6">

        <h3>Presentation</h3>

        <php
        <?php
        if (!empty($user['description'])){
        ?>
            <p>
                <?php echo $user['description'];?>
            </p>
        <?php
        }
        else{
            ?>
            <p>
                Aucune déscription disponible.
            </p>
            <?php
        }
        ?>
    </div>
    
    
    <div class="clear">
        <h3>Sport practise</h3>
        <div class="switchNavigation">
            <div class="navSwitch">

            </div>
             <?php
            if (!empty($usersSports)){
                foreach ($usersSports as $sport){ ?>
                    <div class="item switchContent" id="<?php echo $sport['name'];?>">
                        <h4 class="title "> <?php echo $this->Display->linkSport($sport);?> </h4>
                           
                        <div class="col5 left">
                            <h5>Informations</h5>
                            <?php
                            $sport = $sport['name'];
                            
                            switch ($sport){
                                case 'Snowboard':
                                ?>
                                <table>
                                    <tr>
                                        <td class="rowTitle"> Stance </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Favorite Spin </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Practice since </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Best trick </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Matos </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                </table>
                                <?php
                                break;
                                case 'Ski':
                                ?>
                               <table>
                                    <tr>
                                        <td class="rowTitle"> Favorite Spin </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Practice since </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Best trick </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="rowTitle"> Matos </td>
                                        <td>
                                            <?php echo 'Régulat';?>
                                        </td>
                                    </tr>
                                </table>
                                <?php                                    
                                break;
                            }
                            if ($isMyProfile){
                                ?>
                                <p>
                                   <?php echo $this->Html->link('Editer les infos', array());?>
                                        
                                </p>
                            <?php
                            }
                            ?>
                                
                            </div>
                            <div class="col5 right">
                                <h5>Stats</h5>
                                <div class="">
                                    <ul>
                                        <li> <?php echo $this->Html->link('Consulter ses vidéo', array());?></li>
                                        <li> <?php echo $this->Html->link('Conseilles donnés', array());?></li>
                                    </ul>
                                    
                                    <?php 
                                    if (!$isMyProfile){
                                        ?>
                                    <ul>
                                        <li> <?php echo $this->Html->link('Demander a rider avec lui', array());?></li>
                                    </ul>
                                    
                                    <?php
                                    }
                                    ?>
                                </div>
                            </div>
                    </div>
                <?php
                }
            }
            if ($isMyProfile){
            ?>
                <div class="item switchContent" id="addASport">
                    <h4 class="title" >Add a new sport </h4>
                    <?php
                    // Affichage de la liste des sports disponible
                    echo $this->Form->Create('User',  array('action' => 'addSport'));
                    echo $this->Form->input('Sport', array(
                        'label' => 'Choosed your sports',
                        'options' => $sports,    
                        'multiple' => 'checkbox',
                    ));
                    echo $this->Form->end('Save');
                    foreach ($sports as $sport){

                    }
                    ?>
                </div>
            <?php
            }
            ?>
        </div>
    </div>
    <!--
     <div class='border_radius clear'>
         <h3>Preferite Resorts</h3>
         <p>Exemple :</p><br/>
         <p>Les 7 Laux</p><br/>
         <p>Les 2 Alpes</p>
     </div>
      
    <div class='col9 left border_radius'>
         <h3>Mon Mur</h3>
         <p>Exemple :</p><br/>
         <p>Katty said : I love you <3</p><br/>
    </div>
    -->